from PyQt5.QtWidgets import QWidget, QHBoxLayout, QGroupBox, QVBoxLayout
from pyqt5_plugins.examplebutton import QtWidgets


class InteractiveDemoApp(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        self._add_window()
        # self._add_canvas()
        self._add_buttons()
        self.show()

    def _add_window(self):
        self.setWindowTitle("dawushiyan")
        self.setGeometry(600, 350, 300, 300)

        self.central_widget = QWidget()
        self.setCentralWidget(self.central_widget)
        self.central_widget.setFixedSize(500, 500)


    def _add_buttons(self):
        # 创建控制台部件
        self.control_frame = QtWidgets.QGroupBox("text1", self)
        self.control_frame.setStyleSheet(
            "font-family: Arial; font-size: 23px; font-weight: bold;")
        self.control_frame.setFixedSize(400, 1000)

        # 水平布局管理器 设置为 central_widget 的布局管理器
        horizontal_layout_H = QHBoxLayout()
        self.central_widget.setLayout(horizontal_layout_H)

        self.control_frame_layout = QtWidgets.QGridLayout(self.control_frame)
        # 左上右下
        self.control_frame_layout.setContentsMargins(5, 5, 5, 5)

        # 垂直布局管理器 设置为 control_frame 的布局管理器
        horizontal_layout_V = QVBoxLayout()
        self.control_frame.setLayout(horizontal_layout_V)

        # control_frame的第一个区域---->点击区域
        self.clicks_options_frame = QGroupBox("text1", self.control_frame)
        self.clicks_options_frame.setFixedSize(375, 200)
        self.clicks_options_frame.setGeometry(10, 40, 375, 175)

        # 在布局的顶部插入 clicks_options_frame
        horizontal_layout_V.insertWidget(0, self.clicks_options_frame)

        Clickmanagement_shorizontal_layout_H = QHBoxLayout()
        self.clicks_options_frame.setLayout(Clickmanagement_shorizontal_layout_H)

        self.finish_object_button = QtWidgets.QPushButton("text1", self.clicks_options_frame)
        self.finish_object_button.setGeometry(10, 20, 100, 200)
        self.finish_object_button.setEnabled(False)

        self.undo_click_button = QtWidgets.QPushButton( "text1", self.clicks_options_frame)
        self.undo_click_button.setGeometry(10, 20, 100, 200)
        self.undo_click_button.setEnabled(False)

        self.reset_clicks_button = QtWidgets.QPushButton("text1", self.clicks_options_frame)
        self.reset_clicks_button.setGeometry(10, 20, 100, 200)
        self.reset_clicks_button.setEnabled(False)

        Clickmanagement_shorizontal_layout_H.insertWidget(0, self.finish_object_button)
        Clickmanagement_shorizontal_layout_H.insertWidget(1, self.undo_click_button)
        Clickmanagement_shorizontal_layout_H.insertWidget(2, self.reset_clicks_button)

